package com.khyr.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.khyr.entity.DictType;
import com.khyr.service.DictService;
import com.khyr.vo.DictTypeVo;
import com.khyr.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 宋一恒
 * @version 1.0
 */
@RestController
@RequestMapping("/systemManager/dictType")
public class DictController {
    @Autowired
    private DictService dictService;
    //分页加模糊查询
    @PostMapping("/findDictTypeByCond")
    public R<Page<DictType>> findDictTypeByCond(@RequestBody DictTypeVo dictTypeVo) {
        return dictService.findDictTypeByCond(dictTypeVo);
    }
    //添加字典类型
    @PostMapping("/addDictType")
    public R<Integer> addDictType(@RequestBody DictType dictType) {
        return dictService.addDictType(dictType);
    }

    //修改字典类型
    @PostMapping("/updateDictType")
    public R<Integer> updateDictType(@RequestBody DictType dictType) {
        return dictService.updateDictType(dictType);
    }

    //删除字典类型
    @PostMapping("/deleteDictTypeByIds/{ids}")
    public R<Integer> deleteDictTypeByIds(@PathVariable List<Long> ids) {
        return dictService.deleteDictTypeByIds(ids);
    }

    //查询一个
    @PostMapping("/getDictTypeByDictTypeId/{id}")
    public R<DictType> getDictTypeByDictTypeId(@PathVariable Long id) {
        return dictService.getDictTypeByDictTypeId(id);
    }

}
